function test2(str: `#mes${string}`) {
	const obj = document.getElementById(str);
	return obj;
}

// const aa = test2("#mesabc")

// console.log(aa);

// 普通函数定义
interface IPerson {
	(name: string, age: number): string;
}

const Person: IPerson = function (name: string, age: number) {
	return name + age;
};

const p = Person("zhangsan", 19);

console.log(p);

//  ------------------------------------

// 通过 new 来定义
// 这玩意用来定义类的属性和方法
interface NPerson {
	name: string;
	age: number;
	sayHi(): void;
}

interface NPersonConstructor {
	// 用来定义构建方法
	new (name: string, age: number): NPerson;
}

// 这个工厂函数，用来创建对象
function NPersonFunc(ctx: NPersonConstructor) {
	return new ctx("abc", 123);
}

class ctx {
	name: string;
	age: number;
	constructor(name: string, age: number) {
		this.name = name;
		this.age = age;
	}

	sayHi() {
		console.log("hello owrd");
	}
}

NPersonFunc(ctx);

enum Employeer {
	Name = "name",
	Age = "age",
}

let eName = Employeer.Name;

console.log(eName);

type IsFirst<TArr extends unknown[]> = TArr extends [infer T, ...infer R]
	? T
	: never;

type arrFirst = IsFirst<[string, number]>;

namespace Chapter4 {
	type MyObjType = {
		[Key in keyof T]: T[Key];
	};

	const myObj: Record<string, unknown> = {};

  myObj.aa = "hhaha"
  myObj.bb = 123;
  myObj.test = [234,3,4,'ahah']

	console.log(myObj);
}
